package com.happy016.sender;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class TopicSender {

    @Autowired
    private RabbitTemplate rabbitTemplate;


    /**
     * topic exchange
     * @author Linyb
     * @since 2017/11/22 16:21
     */
    public void sendMessage(){
        System.out.println("Topic  send message ");
        this.rabbitTemplate.convertAndSend("exchange","topic.message","topic.message");
    }

    public void sendMessages(){
        System.out.println("Topic  send  messages ");
        this.rabbitTemplate.convertAndSend("exchange","topic.messages","topic.messages");
    }

}
